.\"     $OpenBSD: fga.4,v 1.14 2015/02/15 22:26:45 bentley Exp $
.\"
.\" Copyright (c) 1999 Jason L. Wright (jason@thought.net)
.\" All rights reserved.
.\"
.\" This software was developed by Jason L. Wright under contract with
.\" RTMX Incorporated (http://www.rtmx.com).
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: February 15 2015 $
.Dt FGA 4 sparc
.Os
.Sh NAME
.Nm fga
.Nd SPARC Force FGA5000 VME/SBus bridge driver
.Sh SYNOPSIS
.Cd "fga0 at iommu0"
.Cd "fvme* at fga0"
.Sh DESCRIPTION
The
.Nm
driver provides a bridge between SBus and VME interfaces.
It has support for accessing VME address and data spaces as if they
were SBus address ranges, and mapping of VME interrupt levels to
SBus interrupts.
The
.Nm
also provides a set of semaphores and mailboxes which are accessible
from user programs via
.Xr ioctl 2 .
.Pp
VME devices are attached to the
.Nm fvme
pseudo-devices, which provide an interface for drivers to establish
VME level/vectored interrupts and map address ranges.
By default the following address ranges are established:
.Bl -column "256MB" "SBus Slot" "SBus Offset" "VME Space" "VME Offset" -offset indent
.It Sy "Size" Ta Sy "SBus Slot" Ta Sy "SBus Offset" Ta Sy "VME Space" Ta Sy "VME Offset"
.It "256MB" Ta "1" Ta "0x0000000" Ta "A32/D32" Ta "0xf0000000"
.It "256MB" Ta "4" Ta "0x0000000" Ta "A32/D16" Ta "0xf0000000"
.It "16MB" Ta "5" Ta "0xe000000" Ta "A24/D16" Ta "0x000000"
.It "64KB" Ta "5" Ta "0xffc0000" Ta "A16/D8" Ta "0x0000"
.It "64KB" Ta "5" Ta "0xffd0000" Ta "A16/D16" Ta "0x0000"
.It "64KB" Ta "5" Ta "0xffe0000" Ta "A16/D32" Ta "0x0000"
.El
.Pp
The abort switch on the FORCE CPU boards is also controlled by the
.Nm fga ,
and is enabled if the eeprom variable
.Pa abort-ena?\&
is set to
.Pa true .
Toggling the switch when enabled stops the kernel and starts the
kernel debugger
.Xr ddb 4 .
.Sh IOCTLS
The
.Nm fga
device responds to the following
.Xr ioctl 2
calls defined in
.In machine/fgaio.h :
.Bl -tag -width FGAIOCSEM
.It Dv FGAIOCSEM
.Pq Li "struct fga_sem"
Clear (release) the semaphore
.Ar fgasem_num .
The argument structure is defined as follows:
.Bd -literal -offset indent
struct fga_sem {
        u_int8_t fgasem_num; /* semaphore number */
	u_int8_t fgasem_val; /* semaphore value */
};
.Ed
.It Dv FGAIOSSEM
.Pq Li "struct fga_sem"
Set (attempt to get) the semaphore
.Ar fgasem_num .
If successful,
.Ar fgasem_val
will have a value of 1, otherwise it will have a value of 0.
.It Dv FGAIOCMBX
.Pq Li "struct fga_sem"
Clear (release) the mailbox
.Ar fgasem_num .
.It Dv FGAIOSMBX
.Pq Li "struct fga_sem"
Set (attempt to get) the mailbox
.Ar fgasem_num .
If successful,
.Ar fgasem_val
will have a value of 1, otherwise it will have a value of 0.
.El
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr ddb 4 ,
.Xr intro 4 ,
.Xr eeprom 8
.Sh HISTORY
.Ox
support for the
.Nm
first appeared in
.Ox 2.6 .
.Sh AUTHORS
The driver for the
.Nm fga
was written by
.An Jason L. Wright Aq Mt jason@thought.net
under contract with
RTMX Incorporated.
.Sh BUGS
There are several features provided by the FGA5000 that are not implemented
in the driver.
Most notably, VME slave ranges are not mapped and the DMA
engine is not used.
Also, several VME interrupts are not handled: SYSFAIL and ACFAIL.
